const Router = require('koa-router')
const { Success } = require('../../core/http-exception')
const { Auth } = require('../../core/middleware/auth')
const { Task } = require('../../models/task')
const router = new Router({
  prefix: '/v1/taskList',
})
router.post('/setTask', new Auth().m, async (ctx, next) => {
  const id = ctx.request.body.id
  const data = await Task.setTask(id, ctx.auth.id)
  ctx.body = {
    code: 200,
    data: data ? '恭喜,已完成' : '请勿重复完成',
  }
})
module.exports = router

